home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk16 / cw11 / cw.doc < prev    next >
Text File  |  1995-03-18  |  4KB  |  117 lines

  1.  
  2.     cw - one-shot stream editor
  3.     Version 1.1
  4.     Copyright (C) 1988 Daniel Elbaum
  5.  
  6.     This code is freely redistributable on the condition that
  7.     nobody make money from it.
  8.  
  9.  
  10.     Syntax: cw <target> <replacement> <file> <file> <file> ...
  11.  
  12.     <target> is the string you want to replace.  This argument
  13.     may contain the following wildcards:
  14.  
  15.         * - replaces any combination of characters.
  16.             Note that this departs from the more common
  17.             meaning of "zero or more occurences of the
  18.             preceding character".
  19.             If this metacharacter is not bounded by a
  20.             normal character, it may wreak havoc:
  21.  
  22.               cw pat* chewie fubar
  23.  
  24.             will replace everything from the first
  25.             occurrence of "pat" to the end of the file
  26.             with the string "chewie".  But
  27.  
  28.               cw pat*rn chewie fubar
  29.  
  30.             will replace any sequence of characters which
  31.             starts with "pat" and ends with "rn".  This
  32.             includes "pattern" as well as "repatched the
  33.                       ^     ^                ^
  34.             hull from stem to stern with fiberglass and mud."
  35.                                   ^
  36.  
  37.         . - replaces any single instance of any character:
  38.             d.g matches "dog", "dig", and so on.
  39.  
  40.         ? - same as '.' but won't match a space.
  41.  
  42.         ^ - matches the beginning of a line (but not a character).
  43.  
  44.               cw ^frog pelvis autobiography
  45.  
  46.             will change the word "frog" into the word "pelvis"
  47.             only where "frog" is the very first thing on a line.
  48.  
  49.         $ - matches the end of a line (but not a character).
  50.  
  51.               cw beer$ vaseline autobiography
  52.  
  53.             will change the word "beer" into the word "vaseline"
  54.             only where "beer" is the very last thing on a line.
  55.  
  56.         \t - matches a tab character: ^\t signifies a leading tab.
  57.  
  58.         \n - matches a newline, so that
  59.  
  60.               cw head\nfirst headfirst novella
  61.  
  62.             will join any lines which are split between the 'd'
  63.             and the 'f' in "headfirst".
  64.  
  65.         \r - matches a carriage return.  These don't generally
  66.             appear in Amiga text files, but you may need it
  67.             someday.
  68.  
  69.         \b - matches a backspace character.
  70.  
  71.         \f - matches a formfeed.
  72.  
  73.  
  74.  
  75.     The <replacement> argument may not contain wildcards except for
  76.     these two: ^$ and \0.  They mean the same thing: replace the
  77.     target string with nothing (in other words, delete it).
  78.  
  79.     The filename arguments may not contain wildcards.
  80.  
  81.     Note that the changes are done IN PLACE.  The wildcards are
  82.     dangerous when not closely supervised, so work on a copy of
  83.     the file, rather than the original.
  84.  
  85.  
  86.     New in Version 1.1:
  87.  
  88.         -Fixed an output buffering problem wherein
  89.          the i/o buffer got flushed twice (it's a
  90.          long way to CON: ;{))
  91.  
  92.         -Fixed a case wherein a few bytes of memory
  93.          were left unfreed when the target file
  94.          couldn't be found.
  95.  
  96.         -Added a special-case replacement string arg,
  97.          "\0", to specify a null replacement string.
  98.          This feature avoids difficulties with the
  99.          quoting/argument-parsing conventions of
  100.          various command interpreters.
  101.  
  102.  
  103.  
  104.     Please report any bugs or suggestions for enhancements to:
  105.  
  106.     Daniel Elbaum
  107.     ARPA: elbaum@reed.EDU
  108.     UUCP: {oresoft,tektronix}!reed!elbaum
  109.     BBS:
  110.         Portland, OR:
  111.             NAG
  112.             Amigaboard! (user #217)
  113.         California:
  114.             AMIC
  115.  
  116.  
  117.